package com.threeox.commonlibrary.inter.event;

import android.view.View;

import com.threeox.commonlibrary.entity.engine.event.EventMessage;
import com.threeox.commonlibrary.entity.engine.request.base.BaseRequestMsg;

/**
 *
 * @ClassName: OnEventListener
 *
 * @Description: TODO(自定义Event事件的回调)
 *
 * @author 赵屈犇
 *
 * @date 创建时间: 2017/7/5 15:21
 *
 * @version 1.0
 *
 */
public interface OnEventListener<T> {

    /**
     * 执行事件之前回调
     *
     * @param view   响应事件的View
     * @param eventMessage    响应事件独享
     * @param params    响应事件的参数
     * @return false  拦截    true 不拦截
     */
    boolean onBeforeExecute(View view, EventMessage eventMessage, Object... params);

    /**
     * 执行事件之后回调
     *
     * @param view
     * @param eventMessage
     * @param params
     * @return
     */
    void onAfterExecute(View view, EventMessage eventMessage, Object... params);

    /*=======================请求对象回调实现函数===========================*/
    /**
     * 请求成功
     *
     * @param requestMsg
     * @param url
     * @param id
     * @param msg
     * @param data
     * @param eventMessage
     */
    void onEventSuccess(BaseRequestMsg requestMsg, String url, int id, String msg, T data, EventMessage eventMessage);

    /**
     * 请求失败
     *
     * @param requestMsg
     * @param url
     * @param id
     * @param code
     * @param msg
     * @param eventMessage
     */
    void onEventError(BaseRequestMsg requestMsg, String url, int id, Object code, String msg, EventMessage eventMessage);

    /**
     * 加载中...
     *
     * @param requestMsg
     * @param progress
     * @param total
     * @param id
     * @param url
     * @param eventMessage
     */
    void inEventProgress(BaseRequestMsg requestMsg, float progress, long total, int id, String url, EventMessage eventMessage);
    /*=======================请求对象回调实现函数===========================*/

}
